package chartor;

import java.awt.Point;
import java.awt.Rectangle;
import java.awt.geom.Point2D;


public class Bullet extends Rectangle{
	private Rectangle shootmanPlayer;
	private int speed;
private Point target;
private double xp;
private double yp;
private double c;
private int damage;
private int num=0;
public Bullet(Point p,Point t,Rectangle player,int w,int h,int damage,int speed) {
	super();
	this.x = p.x;
	this.y=p.y;
	this.target=t;
	this.setShootmanPlayer(player);
	this.xp=target.getX()-this.getX();
	this.yp=target.getY()-this.getY();
	this.c=Point2D.distance(this.getX(),this.getY(),target.getX(),target.getY());
	this.width=w;
	this.height=h;
	this.damage=damage;
	this.speed=speed;
}
public void mont() {
	num+=4;
}
public void move() {
	if(num>0) {
	this.translate((int)(speed*xp/c),(int)(speed*yp/c));
	num--;
	}
}
@Override
public String toString() {
	return "Bullet [shootmanPlayer=" + shootmanPlayer + ", speed=" + speed + ", target=" + target + ", xp=" + xp
			+ ", yp=" + yp + ", c=" + c + ", damage=" + damage + "]";
}
public Rectangle getShootmanPlayer() {
	return shootmanPlayer;
}
public void setShootmanPlayer(Rectangle shootmanPlayer) {
	this.shootmanPlayer = shootmanPlayer;
}
public int getDamage() {
	return damage;
}
public void setDamage(int damage) {
	this.damage = damage;
}
}
